#ifndef __PANEL_H
#define __PANEL_H

#ifdef __cplusplus
 extern "C" {
#endif
   
#include "Bsp.h"
#include "Board.h"

#include "stm32h7xx_hal_ltdc.h"


typedef struct{
	uint32_t	HSPolarity;
	uint32_t	VSPolarity;
	uint32_t	DEPolarity;
	uint32_t	PCPolarity;
	uint32_t	HSync;   
	uint32_t	VSync;  
	uint32_t	HBP;  
	uint32_t	VBP;   
	uint32_t	ActiveW;
	uint32_t	ActiveH;    
	uint32_t	HFP;        
	uint32_t	VFP;      
	uint32_t	Backcolor;                 /*!< Configures the background color. */

	uint32_t	PLL3M;
	uint32_t	PLL3N;
	uint32_t	PLL3P;
	uint32_t	PLL3Q;
	uint32_t	PLL3R;
}Lcd_TypeDef;

//LCD_CS
#define CLR_CS()	          (HAL_GPIO_WritePin(Lcd_CS_Port, Lcd_CS_Pin, GPIO_PIN_RESET))
#define SET_CS()	          (HAL_GPIO_WritePin(Lcd_CS_Port, Lcd_CS_Pin, GPIO_PIN_SET))

// WR
#define CLR_CLK()	          (HAL_GPIO_WritePin(Lcd_CLK_Port, Lcd_CLK_Pin, GPIO_PIN_RESET))
#define SET_CLK()	          (HAL_GPIO_WritePin(Lcd_CLK_Port, Lcd_CLK_Pin, GPIO_PIN_SET))

//DATA
#define CLR_DATA()	          (HAL_GPIO_WritePin(Lcd_DATA_Port, Lcd_DATA_Pin, GPIO_PIN_RESET))
#define SET_DATA()	          (HAL_GPIO_WritePin(Lcd_DATA_Port, Lcd_DATA_Pin, GPIO_PIN_SET))

//REST
#define EN_LOW()	          (HAL_GPIO_WritePin(Lcd_EN_Port, Lcd_EN_Pin, GPIO_PIN_RESET))
#define EN_HIG()	          (HAL_GPIO_WritePin(Lcd_EN_Port, Lcd_EN_Pin, GPIO_PIN_SET))

void SendData(uint8_t cmd,uint8_t data);
	

#if(LCD_PANEL_TYPE == LCD_400X960_GC9503V_4INCH)
	#include "LCD_400X960_GC9503V_4INCH.h"
#elif(LCD_PANEL_TYPE == LCD_480X480_GC9503V_2_1INCH)
	#include "LCD_480X480_GC9503V_2_1INCH.h"
#elif(LCD_PANEL_TYPE == LCD_800X480_4_3INCH)
	#include "LCD_800X480_4_3INCH.h"
#elif(LCD_PANEL_TYPE == LCD_1024X600_7INCH)
	#include "LCD_1024X600_7INCH.h"
#elif(LCD_PANEL_TYPE == LCD_400X1280_7_8INCH)
	#include "LCD_400X1280_7_8INCH.h"
#elif(LCD_PANEL_TYPE == LCD_800X480_7INCH)
	#include "LCD_800X480_7INCH.h"
#elif(LCD_PANEL_TYPE == LCD_1024X600_7INCH_50PIN)
	#include "LCD_1024X600_7INCH_50PIN.h"	
#elif(LCD_PANEL_TYPE == LCD_480X272_4_3INCH_8BIT)
	#include "LCD_480X272_4_3INCH_8BIT.h"	
	
#else
	#error "No Panel"
#endif

#ifdef __cplusplus
}
#endif
#endif
